﻿//-----------------------------------------------------------------------
// <copyright file="PathUtil.cs" company="INL sprl">
//     Copyright 2010 INL sprl.
// </copyright>
// Fabrice avaux : Date de création 16/10/2010
//-----------------------------------------------------------------------

namespace ParseXAML
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    /// <summary>
    /// Class used to calculate Relative Path
    /// </summary>
    internal static class PathUtil
    {
        internal static string GetRelativePath(string rootPath, string fullPath)
        {
            rootPath = System.IO.Path.GetFullPath(rootPath).ToLowerInvariant();
            string lowerfullPath = System.IO.Path.GetFullPath(fullPath).ToLowerInvariant();

            if (!lowerfullPath.StartsWith(rootPath))
                return fullPath;

            return fullPath.Substring(rootPath.Length);
        }
    }
}
